package czx.wt.system.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import czx.wt.common.response.Pager;
import czx.wt.common.response.ResponseData;
import czx.wt.system.mapper.UserMapper;
import czx.wt.system.pojo.User;
import czx.wt.system.service.IUserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ChenZhiXiang
 * @Date: 2019/6/19 22:32
 * @Description: 用户实现层
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Override
    public User findUserByUsername(String username) {
        return baseMapper.findUserByUsername(username);
    }

    @Override
    public Object getAllUser(int pageNum,int pageSize) throws Exception {
        List<User> users = baseMapper.getAllUser();
        Pager<User> pager = new Pager(pageNum,pageSize,users);
        return ResponseData.turnResponse(pager);
    }
}
